import Vue from 'vue'
import Vuex from 'vuex'
 
Vue.use(Vuex)
 
export default new Vuex.Store({
  state: {
    webSite:"深圳刀客天下",
    shopCar:[
        {title:'商品',price:0.00,num:1}
    ],
    currentUser:[]
  },

  getters: {
    shopCatTotal(state){
        let total = 0;
        state.shopCar.forEach((item)=>{
            total += item.price * item.num
        });
        return total;
    }
  },
  //里面定义方法，操作state方发
  mutations: {
    
  },
  // 操作异步操作mutation
  actions: {
    
  },
  modules: {
    
  },
})